Introduce getter functions for host and subsystem objects with on-demand creation#3051
Merged
igaw merged 6 commits intolinux-nvme:masterfrom Jan 20, 2026
Merged
Introduce getter functions for host and subsystem objects with on-demand creation#3051igaw merged 6 commits intolinux-nvme:masterfrom
igaw merged 6 commits intolinux-nvme:masterfrom
Conversation
Move configuration update code into the library. This completes the migration. Afterward, nvme-cli depends only on higher-level APIs, enabling internal library refactoring without breaking public interfaces. Signed-off-by: Daniel Wagner <[email protected]>
There is no user for this, thus remove it. Signed-off-by: Daniel Wagner <[email protected]>
Replace nvme_default_host() with generic nvme_host_get(), which creates the host object on demand. This enables retiring nvme_lookup_host() from the public API. Signed-off-by: Daniel Wagner <[email protected]>
Split host creation code into a separate function to explicitly document on-demand object creation. Signed-off-by: Daniel Wagner <[email protected]>
Replace the nvme_lookup_subsystem function with the nvme_subsystem_get function, which creates the subsystem object if necessary. This allows retiring the nvme_lookup_subsystem function from the public API. Signed-off-by: Daniel Wagner <[email protected]>
There are no public users for these function. Make them private so we can refactor them without breaking the API in future. Signed-off-by: Daniel Wagner <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After moving the configuration update code into the library, the lookup functions can now be moved into the private section. It is still necessary to retrieve host and subsystem objects, so new getter functions are introduced.
These getters create the object on demand, providing the global context at creation time. While this could be added to the old lookup API, splitting the functionality is cleaner and avoids regressions.
This lays the groundwork for future refactoring while keeping the public API stable.